<%@page import="com.cn.simplify.xutil.enums.Whether"%>
<%@page import="com.cn.simplify.xutil.enums.RoleType"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="roleType_admin" value="<%=RoleType.ADMIN %>" />
<c:set var="roleType_user" value="<%=RoleType.USER %>" />
<c:set var="default_yes" value="<%=Whether.YES %>" />
<c:set var="default_not" value="<%=Whether.NOT %>" />
<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <title>角色管理</title>
  </head>
  <body>
    <div class="container-fluid">
      <!-- 路径导航 -->
	  <ol class="breadcrumb">
	    <li><a href="${ctx}/workbench">主页</a></li>
	    <li><a href="${ctx}/role">角色管理</a></li>
	    <li class="active">
	      <c:if test="${action eq 'create'}">添加角色</c:if>
	      <c:if test="${action eq 'update'}">修改角色</c:if>
	    </li>
	  </ol>
	  <!-- /路径导航 -->
	  
	  <div class="panel panel-default">
	    <div class="panel-heading">
	      <h3 class="panel-title">
	        <c:if test="${action eq 'create'}">添加角色</c:if>
	        <c:if test="${action eq 'update'}">修改角色</c:if>
	      </h3>
	    </div>
	    
	    <div class="panel-body">
	      <form class="form-horizontal" id="role-form" action="${ctx}/role/${action}" method="post" role="form">
	        <input type="hidden" id="role-id" name="id" value="${role.id}">
	        
	        <div class="form-group">
	          <label for="role-name" class="col-sm-2 control-label">角色名称</label>
	          <div class="col-sm-10">
	            <input type="text" class="form-control" id="role-name" name="name" value="${role.name}" placeholder="角色名称">
	          </div>
	        </div>
	        
	        <div class="form-group">
	          <label for="role-name" class="col-sm-2 control-label">角色代码</label>
	          <div class="col-sm-10">
	            <input type="text" class="form-control" id="role-code" name="code" value="${role.code}" placeholder="角色代码">
	          </div>
	        </div>
	        
	        <div class="form-group">
	          <label for="role-name" class="col-sm-2 control-label">角色类型</label>
	          <div class="col-sm-10">
	          <label class="radio-inline"> <input type="radio" name="roleType" value="${roleType_admin}" <c:if test="${role.roleType eq roleType_admin}">checked="checked"</c:if>>${roleType_admin.value}</label> 
	          <label class="radio-inline"> <input type="radio" name="roleType" value="${roleType_user}" <c:if test="${role.roleType ne roleType_admin}">checked="checked"</c:if>>${roleType_user.value}</label>
	          </div>
	        </div>
	        
	        <div class="form-group">
	          <label for="role-name" class="col-sm-2 control-label">是否默认角色</label>
	          <div class="col-sm-10">
	            <label class="radio-inline"> <input type="radio" name="defaultRole" class="uniform" value="${default_yes}" <c:if test="${role.defaultRole eq default_yes}">checked="checked"</c:if>>${default_yes.value}</label>
	            <label class="radio-inline"> <input type="radio" name="defaultRole" class="uniform" value="${default_not}" <c:if test="${role.defaultRole ne default_yes}">checked="checked"</c:if>>${default_not.value}</label>
	          </div>
	        </div>
	        
	        <div class="form-group">
	          <div class="col-sm-offset-2 col-sm-10">
	            <button type="submit" class="btn btn-default"> 提 交 </button>
	            <button type="button" class="btn btn-default" onclick="history.back()"> 返 回 </button>
	          </div>
	        </div>
	      </form>
	    </div>
	    
	  </div>

	</div>
	
	<!-- 以下开始 加载JS动态效果 -->
	
	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="${ctx}/static/jquery/jquery-1.11.1.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="${ctx}/static/bootstrap-3.2.0-dist/js/bootstrap.min.js"></script>
  </body>
</html>